import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { Medication } from '#/api/healthPlan/config/planConfig/model';

export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'templateName',
    label: '模板名称',
  },
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  {
    title: '模板名称',
    field: 'templateName',
    width: 500,
  },
  {
    title: '用药内容列表',
    field: 'medications',
    formatter: ({ cellValue }) => {
      return cellValue.map((item: Medication) => item.medicationName).join(',');
    },
  },
  // {
  //   title: '状态',
  //   field: 'status',
  // },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];
